<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019\1\26 0026
 * Time: 19:27
 */
namespace app\admin\behavior;
use think\Controller;
use think\Request;

class CheckLogin extends Controller
{
    public function run(Request $request)
    {
        $model = strtolower($request->module());
        if ($model == 'admin'){
            if (!session('username')) {
                $action = strtolower($request->controller());
                $login = 'login';
                if ($action !== $login) {
                    $this->redirect('login/login');

                }


            }
    }
    }
}
